import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import seaborn as sns
#import data from txt
a=np.loadtxt('a.txt')
a=a.reshape((50,20,20))
xlenth=20
ylenth=20
tlenth=50
x=np.arange(0,xlenth,1)
y=np.arange(0,ylenth,1)
X,Y=np.meshgrid(x,y)

sns.set_style("whitegrid")
fig,ax=plt.subplots()
fig.set_tight_layout(True)

line,=ax.pcolor(X,Y,a[1,:,:])

def update(i):
    plt.cla()
    line,=ax.pcolor(X,Y,a[i,:,:])
    return line,

anim=FuncAnimation(fig,update,frames=np.arange(0,tlenth,1),interval=1)
plt.show()
